package com.itheima.controller;

import com.itheima.anno.Log;
import com.itheima.common.BarChartData;
import com.itheima.common.R;
import com.itheima.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@CrossOrigin
@RequestMapping("/customer")
public class ReportController {

    @Autowired
    CustomerService customerService;

    //根据年龄段统计数量
    /**
     * 根据年龄段统计人数
     * @return R
     */
    @Log
    @GetMapping("/ageReport")
    public R queryCountGroupByAge(){
        BarChartData barChartData = customerService.queryCountGroupByAge();
        return R.ok(barChartData);
    }
}
